#include <iostream>
using namespace std;

int main() {
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        int ans[10]={0};
        for (int i=1; i<=n; ++i){
            string s = to_string(i);
            for(int j=0; j<s.size(); ++j) ans[s[j]-'0']++;
        }
        for(int i=0; i<9; ++i) cout << ans[i] << " ";
        cout << ans[9] << endl;
        string s;

    }
    return 0;
}
